package io.fredia.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import io.fredia.dao.UserDao;
import io.fredia.domain.User;

@Service  
public class UserServiceImpl implements UserService {

	@Autowired  
    private UserDao userDao;  
  
    public User selectUserById(Integer userId) {  
        return userDao.selectUserById(userId);  
    }
    
    @Transactional(propagation=Propagation.REQUIRED)
	public void addUser(User user) {
		userDao.addUser(user);
		
		//TODO 人工模拟异常
		/*String string  = null;
		if(string.equals("")) {
			int i = 0;
		}*/
	}  
}
